package com.yale.elasticsearch.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @author :yale
 * @date : 2024/8/6
 */
@Data
@ApiModel(description = "布尔查询")
public class BoolQueryDTO {
    @ApiModelProperty(value = "索引名称")
    private String indexName;
    @ApiModelProperty(value = "查询类型和字段以及字段值")
    private List<QueryTypeDTO> queryType;
    @Data
    public static class QueryTypeDTO{
        @ApiModelProperty(value = "查询类型；1：字符串；2：布尔值；3：数字范围；4：日期范围")
        private Integer type;
        @ApiModelProperty(value = "查询值")
        private List<QueryDTO> query;
    }
    @Data
    public static class QueryDTO{
        @ApiModelProperty(value = "查询字段")
        private String field;
//        @ApiModelProperty(value = "查询字段; 字符串数组，用于多值查询")
//        private String[] fieldArray;
        @ApiModelProperty(value = "查询值; 字符串")
        private String valueForString;
        @ApiModelProperty(value = "查询值; 字符串数组，用于多值查询")
        private String[] valueForStringArray;
        @ApiModelProperty(value = "查询值; 布尔值")
        private Boolean valueForBoolean;
        @ApiModelProperty(value = "查询数字范围值; 最小数字")
        private String valueForMinNumber;
        @ApiModelProperty(value = "查询数字范围值; 最大数字")
        private String valueForMaxNumber;
        @ApiModelProperty(value = "查询日期范围值; 开始日期 格式：yyyy-MM-dd")
        private String valueForStartDate;
        @ApiModelProperty(value = "查询日期范围值：结束日期 格式：yyyy-MM-dd")
        private String valueForEndDate;
    }
}
